package com.yupi.springbootinit.bizmq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.util.Scanner;

/**
 * 用于测试（只用执行一次）
 */
public class MQInitMain {
    private static final String EXCHANGE_NAME = "code_exchange";

    public static void main(String[] args) {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
        try (Connection connection = factory.newConnection();
             Channel channel = connection.createChannel()) {
            channel.exchangeDeclare(EXCHANGE_NAME, "direct");
            channel.queueDeclare("code_queue",true,false,false,null);
            channel.queueBind("code_queue",EXCHANGE_NAME,"myRoutingKey");


        }catch (Exception e){

        }
    }
}
